﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ASPDotNetSamples;
using Telerik;  

public partial class Admin_TransactionSearch : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {

            startDateStr.SelectedDate = System.DateTime.Now;
            endDateStr.SelectedDate = System.DateTime.Now;
            //startDateStr.SelectedDate = DateTime.Now.AddDays(-1).ToShortDateString().Replace("/", "-");
            //endDateStr.SelectedDate = DateTime.Now.ToShortDateString().Replace("/", "-");
            this.DataBind();

        }
    }


    protected void btnSubmit_Click(object sender, EventArgs e)
    {

        Global.is3token = true;
        Session["stage"] = "SandBox";
        SetProfile.SessionProfile = SetProfile.CreateAPIProfile(Constants.API_USERNAME, Constants.API_PASSWORD, Constants.API_SIGNATURE, "", "", "", "", "SandBox", "");

        PayPalAPI api = new PayPalAPI();

        DateTime startDate =Convert.ToDateTime(startDateStr.SelectedDate);
        DateTime endDate = Convert.ToDateTime(endDateStr.SelectedDate);
        this.Session[Constants.TRANSACTION_SEARCH_SESSION_KEY] = api.TransactionSearch(startDate, endDate, transactionID.Value);
        Response.Redirect("TransactionSearchResults.aspx");
    }
}
